package com.endoc.base.utils;

import java.io.File;

/**
 *数据格式化工具
 */
public class DecimalFormatUtils {
    public static byte[] floatToByte(String data){
        float floatData = Float.parseFloat(data);
        java.text.DecimalFormat df =new java.text.DecimalFormat("#.0");
        String dataFormat=df.format(floatData);
        System.out.println("dataFormat: "+dataFormat);
        byte result[] =new byte[2];
        String[] split = dataFormat.split("\\.");
        //坑:File.separator是文件分割符合,和转义符合没关系,两个概念
        System.out.println("split length: "+split.length);
        result[0] = (byte) Integer.parseInt(split[0]);
        result[1] = (byte) Integer.parseInt(split[1]);
        return result;
    }
}
